//
//  LandAndResignViewController.m
//  悦享
//
//  Created by 韩双 on 16/3/28.
//  Copyright © 2016年 张洪国. All rights reserved.
//

#import "LandAndResignViewController.h"

@interface LandAndResignViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, retain) NSArray *landArr;

@end

@implementation LandAndResignViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.navigationItem.title = @"登录";
    
    self.landArr = [NSArray arrayWithObjects:@"手机号注册/登录", @"新浪微博", @"QQ", @"腾讯微博", @"人人网", nil];
 
    
    [self createTableView];
    
}

#pragma mark - 创建TableView
- (void)createTableView {
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SREEN_WIDTH, SREEN_HEIGHT) style:UITableViewStylePlain];
    
    _tableView.scrollEnabled = NO;
    
    [self.view addSubview:_tableView];
    
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    [_tableView registerClass:[LandTableViewCell class] forCellReuseIdentifier:@"LandTableViewCell"];
    
    
}

#pragma mark - TableView协议方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return _landArr.count;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    LandTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LandTableViewCell"];
    
    cell.lable.text = _landArr[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    if (indexPath.row == 0) {
        
        PhoneLandViewController *phoneVC = [[PhoneLandViewController alloc] init];
        
        [self.navigationController pushViewController:phoneVC animated:YES];
    }
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
